package com.zhj.bz.datastructure.recursion;

/**
 * @author zhj
 */
public class RecursionTest {
    public static void main(String[] args) {
        // test(10);
        System.out.println(factorial(3));
    }
    // 打印问题
    public static void test(int n) {
        if (n > 2) {
            test(n - 1);
        }
        System.out.println("n=" + n);
    }

    public static int factorial(int n) {
        if (n == 1) {
            return 1;
        }
        return factorial(n - 1) * n;
    }
}
